<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/18
 * Time: 14:30
 */
namespace Home\Controller;
//use Think\Controller;

class DmeController extends CommonController
{

    /*
     * 商户DME同事通讯录
     */
    public function DME_colleague_list(){
        $get = I('data');
        $get = $this->jiemi($get);
        if (empty($get["user_id"])) {
            $data['ret'] = '1002';
            $data['code'] = '请先登录';
            $data1 = $this->jiami($data);
            $this->return = ['data' => $data1];
            return false;
        }
        $get['shop_identifier']='0100010020';
        if(empty($get['shop_identifier'])){
            $data['ret'] = '1002';
            $data['code'] = '商户号为空';
            $data1 = $this->jiami($data);
            $this->return = ['data' => $data1];
            return false;
        }
        $page=empty($get['page'])?0:$get['page'];
        $lime=empty($get['limit'])?7:$get['limit'];
        $shopkeeper=M('shopkeeper','','DB2')->where(['shop_idenfier'=>$get['shop_identifier'],'state'=>1])->limit($page,$lime)->field('id,account,picture,name,rid')->order('ctime desc')->select();
        foreach ($shopkeeper as $key=>$value){
            $shopkeeper[$key]['picture']=empty($value['picture'])?'':$value['picture'];
        }
        $data['ret'] = '1001';
        $data['code'] = 'success';
        $data['is_null'] = empty($shopkeeper) ? 1 : 0;
        $data['page'] = (string)(count($shopkeeper) + $page);
        $data['data'] = $shopkeeper;
        $data1 = $this->jiami($data);
        $this->return = ['data' => $data1];
        return true;
    }
}